import React, { JSX } from 'react';
import { NulCommonOperations, NulDialog, NulFormItem } from '../../components/NulDialog';
import { DicomFileViewer } from '../../components/DicomViewer';
import { Box } from '@mui/material';
import { transformAnalyzeResult } from '../../util/TextTransform';

interface AnalyzeResultProps {
  open: boolean;
  onClose: () => void;
  dicomFile?: File;
  result: string;
};

function AnalyzeResult(props: AnalyzeResultProps): JSX.Element {
  const { open, onClose, dicomFile, result } = props;

  return (
    <NulDialog
      open={open}
      onClose={onClose}
      title='Result'
      operations={
        <NulCommonOperations onPositiveClicked={onClose} onNegativeClicked={onClose} />
      }
    >
      <DicomFileViewer file={dicomFile} width='300px' height='300px' />
      <Box height='20px' />
      <NulFormItem hint='Result' necessary={false} component={transformAnalyzeResult(result)} />
    </NulDialog>
  );
}

export { AnalyzeResult };